-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inventory firmware #261
Inventory firmware #261
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this is quite a large PR. Might take me some time to get through.
@jacobweinstock thanks for taking a look at this! let me know when you're done and I can cut a v0.5.3 release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't programmed against many of these BMCs, but have a few suggestions on the PR
04afa2d
to
aac60b0
Compare
aac60b0
to
623847d
Compare
@micahhausler thanks for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup. I have just a few minor suggestions
// FirmwareInstall uploads and initiates firmware update for the component | ||
func (a *ASRockRack) FirmwareInstall(ctx context.Context, component, applyAt string, forceInstall bool, reader io.Reader) (jobID string, err error) { | ||
var size int64 | ||
if file, ok := reader.(*os.File); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If length is required, maybe consider a different interface like fs.File
or you could declare an interface like
type LengthReader interface {
io.Reader
Len() int
}
which is satisfied by bytes.Buffer
and strings.Reader
and provide a helper for os.File/fs.File
like
type lr struct {
fs.File
}
func (lr *r) Len() int {
info, err := r.Stat()
if err != nil {
panic(err) // or ignore/log
}
return int(info.Size())
}
// LengthReaderFromFile returns a LengthReader from an fs.File
func LengthReaderFromFile(f fs.File) LengthReader {
return &lr{f}
}
providers/asrockrack/firmware.go
Outdated
a.log.V(2).Info("info", "action", "set device to flash mode, takes a minute...", "step", "1/4") | ||
err = a.setFlashMode(ctx) | ||
if err != nil { | ||
return fmt.Errorf("failed in step 1/4 - set device to flash mode: " + err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use errors.Wrap()
? That would allow callers to use errors.Is()
. Same for the other steps in this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion here, as of now the file size is required for the multipart upload. I've created a separate issue to follow up on the LengthReader interface #261 (comment)
Fixed up errors Wrap in aa25390
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, needs a rebase
- include example
…wareInstallVerifier
…rifier interface methods
…stallVerifier interface methods - use context for all requests - implement various helper methods for inventory, firmware updates - split up firmware install, status methods - add tests
… FirmwareInstallUnknown this is so that the caller is aware that the BMC is not aware of the component version and can decide if it wants to power cycle or take other actions. instead of assuming the device needs a powercycle
…payload this is an attempt to have the BMC preserve the User, Network BMC configuration after a flash
…eset error returned when the install status lookup fails
This enables the ASRR and Redfish providers to reset the BMC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking great! Just a few minor changes
3c070f6
to
ca6978d
Compare
Codecov Report
@@ Coverage Diff @@
## master #261 +/- ##
==========================================
+ Coverage 23.73% 23.94% +0.21%
==========================================
Files 59 70 +11
Lines 10276 11425 +1149
==========================================
+ Hits 2439 2736 +297
- Misses 7300 8094 +794
- Partials 537 595 +58
Continue to review full report at Codecov.
|
- moves the optional component parameter at the end - providers/asrockrack/firmware: wrap FirmwareInstall errors
ca6978d
to
04ed8e8
Compare
04ed8e8
to
92f6fc0
Compare
rebased on master and squashed a few similar commits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, no blocking changes
also fixes the registrar.Verifier implementation
Tests added
Similar commits squashed
What does this PR implement?
InventoryGetter
interface for Redfish, AsrockrackFirmwareInstaller
,FirmwareInstallVerifier
interfacesPostCodeGetter
interface for AsrockrackPowerStateGetter
,PowerState
setter interfaces for AsrockrackThe HW vendor this change applies to
The HW model number, product name this change applies to
What version of tooling - vendor specific or opensource does this change depend on
Description for changelog/release notes
InventoryGetter
interface for Redfish, AsrockrackFirmwareInstaller
,FirmwareInstallVerifier
interfacesPostCodeGetter
interface for AsrockrackPowerStateGetter
,PowerState
setter interfaces for Asrockrack